<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title> M宝商城个人首页 </title>
    <link rel="stylesheet" href="../css/首页.css">
    <script src="../js/jquery.js"></script>
    <script src="../js/jquery.min.js"></script>
    <script>
        window.onload = function() {
            var url = ['http://mbaoshop.oss-cn-shenzhen.aliyuncs.com/Uploads/Picture/2019-09-05/5d70d1858ddce.png', 
            'http://mbaoshop.oss-cn-shenzhen.aliyuncs.com/Uploads/Picture/2019-09-12/5d79eeb214a49.png',
            'http://mbaoshop.oss-cn-shenzhen.aliyuncs.com/Uploads/Picture/2019-08-14/5d53b08c0f343.jpg'];
            var alt=['天灵宝燕','伊肤泉','中秋味道'];
            var img = document.querySelector('#Carousel');
            var i = 0;            
            $('#navbar1>.container>#box>#nav1>li').eq(0).css('background-color', 'rgba(0, 0, 0, .6)');
            // $("#Carousel").fadeOut("slow");
            setInterval(function() {
                if (i == 3) i = 0;
                img.src = url[i];
                img.alt=alt[i];
                i++;
                $('#navbar1>.container>#box>#nav1>li').eq(i-2).css('background-color', 'rgba(153, 153, 153, .6)');
                $('#navbar1>.container>#box>#nav1>li').eq(i-1).css('background-color', 'rgba(0, 0, 0, .6)');
                $('#navbar1>.container>#box>#nav1>li').hover(
                    function () {
                        
                        $('#navbar1>.container>#box>#nav1>li').css('background-color', 'rgba(153, 153, 153, .6)');
                        $(this).css('background-color', 'rgba(0, 0, 0, .6)');
                        img.src=url[this.value];
                        // i=this.value;
                    },
                );
            }, 4000);     
        }  
        $(function(){
            let num = location.search.split('=')[1];
            console.log(num);
            var pho=document.getElementById("phone");
            var shopcar=document.getElementById("shopcar");
            pho.innerHTML="[ "+num+" ]";
            shopcar.href="./购物车.html?phone="+num;
        })
    </script>
    <!-- Bootstrap -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询（media queries）功能 -->
    <!-- 警告：通过 file:// 协议（就是直接将 html 页面拖拽到浏览器中）访问页面时 Respond.js 不起作用 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
      <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
    <![endif]-->
    </head>
    <body>
        <!-- 头部 -->
        <div id="site-nav">
            <div class="container">
                <p class="col-xs-3">嗨~，欢迎来到M宝商城！</p>
                <div class="col-xs-9">
                    <ul id="right">
                        <li><a href="javascript:void;" style="color: #2d8701;" id="phone">登录</a></li>
                        <li><a href="./首页.html">[ 退出 ]</a></li>
                        <li><a href="./登录.html" target="_blank">我的订单</a></li>
                        <li class="user">
                            <a href="./登录.html" target="_blank">个人中心
                                <i class="sj"></i>
                            </a>
                            <ul class="subnav">
                                <li><a href="">我的优惠券</a></li>
                                <li><a href="">我的收藏</a></li>
                                <li><a href="">我的店铺</a></li>
                                <li><a href="">我的邀请</a></li>
                            </ul>
                        </li>
                        <li><a href="#">手机版</a></li>
                    </ul>
                </div>
            </div>
        </div>
        <!-- 顶部logo -->
        <nav class="navbar" style="height: 112px;border-bottom: 1px #eeeeee solid;">
                <div class="container" style="height: 100%;">
                    <!-- Brand and toggle get grouped for better mobile display -->
                    <div class="navbar-header col-xs-4 nav" style="height: 100%;">
                        <a class="navbar-brand" href="#"><img src="http://mbaoshop.oss-cn-shenzhen.aliyuncs.com//Uploads/Picture/2017-07-10/59632c0977fde.png" alt=""></a>
                    </div>
                    <div class="col-xs-8 nav" style="height: 100%; float: left;">
                        <ul style="padding: 0px;">
                            <li class="col-xs-9" style="padding: 0px;">
                                <form class="navbar-left col-xs-12" style="padding-right:20px;">
                                    <div class="form-group col-xs-10" style="padding: 0px;">
                                        <input type="text" class="form-control" placeholder="购买您想要的商品">
                                    </div>
                                    <button type="submit" class="col-xs-2" >搜索</button>
                                </form>
                            </li>
                            <li class="box col-xs-3" style="padding: 0px;">
                                <a href="./购物车.html" class="btn btn-positive" id="shopcar">
                                    <i class="glyphicon glyphicon-shopping-cart"></i>我的购物车
                                    <span class="badge">0</span>
                                </a>
                            </li>
                        </ul>
                    </div>
                </div><!-- /.container-fluid -->
        </nav>
        <!-- 导航条 -->
        <div class="navbar" id="navbar">
            <div class="container">
                <div class="navbar-header col-xs-2" id="box">
                    <a href="">
                        浏览全部商品
                        <i class="glyphicon glyphicon-menu-down" style="color: #bbbbbb;"></i>
                    </a>
                </div>
                <div class="after-sale" id="box" style="width: 10%;"><a href="">售后服务</a></div>
                <span style="float: right;line-height: 50px;">客服热线：</span>
            </div>
        </div>
        <!-- 轮播图 -->
        <div id="navbar1">
            <div class="container">
                <ul id="nav">
                    <li><a href="">家用电器
                        <i class="glyphicon glyphicon-menu-right" style="color: #bbbbbb;"></i>
                        </a></li>
                    <li><a href="">家居生活
                        <i class="glyphicon glyphicon-menu-right" style="color: #bbbbbb;"></i>
                        </a></li>
                    <li><a href="">食品饮料
                        <i class="glyphicon glyphicon-menu-right" style="color: #bbbbbb;"></i>
                        </a></li>
                    <li><a href="">服装
                        <i class="glyphicon glyphicon-menu-right" style="color: #bbbbbb;"></i>
                        </a></li>
                    <li><a href="">数码手机
                        <i class="glyphicon glyphicon-menu-right" style="color: #bbbbbb;"></i>
                        </a></li>
                </ul>
                <div id="pic"><a href="" target="_blank">
                    <img src="http://mbaoshop.oss-cn-shenzhen.aliyuncs.com/Uploads/Picture/2019-09-05/5d70d1858ddce.png" alt="" id="Carousel">
                    </a></div>
                <div id="box">
                    <ul id="nav1">
                        <li value="0">天灵宝燕</li>
                        <li value="1">伊肤泉</li>
                        <li value="2" style="border: 0;">中秋味道</li>
                    </ul>
                </div>
            </div>
        </div>
        <!-- 主体 商品列表 -->
        <!-- 列表1 -->
        <div style="width: 100%;background: #f2f2f2;">
            <div class="container" id="main">
                    <div class="col-xs-12" style="position: relative;padding: 0;">
                        <div class="item-title" id="title1">
                            <h3>
                                <span>
                                    <a href="">家用电器</a>
                                </span>
                            </h3>
                        </div>
                        <div class="list col-xs-12" id="list1" style="padding: 0;">
                        </div>                 
                        <script>
                            $(function() {
                                let num = location.search.split('=')[1];
                                console.log(num);
                                $.ajax({
                                    url: "../lib/getall1.php",
                                    type: "get",
                                    dataType: "json",
                                    success: function(data){
                                        console.log(data);
                                        let temp="";
                                        data.forEach(element => {
                                            // console.log(JSON.parse(element.pic));
                                            let pic=JSON.parse(element.pic);
                                            // console.log(pic);
                                            temp+=`
                                                <li value="${element.id}">
                                                    <a href="./商品详情.html?phone=${num}&id=${element.id}">
                                                        <div class="p-pic">
                                                            <img src="${pic[0].src}" alt="${pic[0].title}">
                                                        </div>
                                                        <div class="p-title">
                                                            <a href="./商品详情.html?phone=${num}&id=${element.id}">
                                                                ${element.title};
                                                            </a>
                                                        </div>
                                                        <div class="p-price">
                                                            <h3><span class="yuan">￥</span>${element.price}</h3>
                                                            <a href="./商品详情.html?phone=${num}&id=${element.id}">立刻购买</a>
                                                        </div>
                                                    </a>
                                                </li>
                                            `;
                                        });
                                        // console.log(temp);
                                        $('#list1').append(temp);
                                    }
                                });
                            });
                        </script>
                    </div>
            </div>
        </div>
        <!-- 列表2 -->
        <div style="width: 100%;background: #f2f2f2;">
                <div class="container" id="main">
                    <div class="col-xs-12" style="position: relative;padding: 0;">
                        <div class="item-title" id="title2">
                            <h3>
                                <span>
                                    <a href="">家居生活</a>
                                </span>
                            </h3>
                        </div>
                        <div class="list col-xs-12" id="list2">
                        </div>
                        <script>
                            $(function() {
                                let num = location.search.split('=')[1];
                                console.log(num);
                                $.ajax({
                                    url: "../lib/getall2.php",
                                    type: "get",
                                    dataType: "json",
                                    success: function(data){
                                        // console.log(data);
                                        let temp="";
                                        data.forEach(element => {
                                            // console.log(element.pic);
                                            // console.log(JSON.parse(element.pic));
                                            let pic=JSON.parse(element.pic);
                                            // console.log(pic);
                                            temp+=`
                                                <li value="${element.id}">
                                                    <a href="./商品详情.html?phone=${num}&id=${element.id}">
                                                        <div class="p-pic">
                                                            <img src="${pic[0].src}" alt=".${pic[0].title}">
                                                        </div>
                                                        <div class="p-title">
                                                            <a href="./商品详情.html?phone=${num}&id=${element.id}">
                                                                ${element.title};
                                                            </a>
                                                        </div>
                                                        <div class="p-price">
                                                            <h3><span class="yuan">￥</span>${element.price}</h3>
                                                            <a href="./商品详情.html?phone=${num}&id=${element.id}">立刻购买</a>
                                                        </div>
                                                    </a>
                                                </li>
                                            `;
                                        });
                                        // console.log(temp);
                                        $('#list2').append(temp);
                                    }
                                });
                            });
                        </script>
                    </div>
                </div>
        </div>
        <!-- 列表3 -->
        <div style="width: 100%;background: #f2f2f2;">
                <div class="container" id="main">
                    <div class="col-xs-12" style="position: relative;padding: 0;">
                        <div class="item-title" id="title3">
                            <h3>
                                <span>
                                    <a href="">母婴玩具</a>
                                </span>
                            </h3>
                        </div>
                        <div class="list col-xs-12" id="list3">
                        </div>
                        <script>
                            $(function() {
                                let num = location.search.split('=')[1];
                                console.log(num);
                                $.ajax({
                                    url: "../lib/getall3.php",
                                    type: "get",
                                    dataType: "json",
                                    success: function(data){
                                        // console.log(data);
                                        let temp="";
                                        data.forEach(element => {
                                            // console.log(element.pic);
                                            // console.log(JSON.parse(element.pic));
                                            let pic=JSON.parse(element.pic);
                                            // console.log(pic);
                                            temp+=`
                                                <li value="${element.id}">
                                                    <a href="./商品详情.html?phone=${num}&id=${element.id}">
                                                        <div class="p-pic">
                                                            <img src="${pic[0].src}" alt=".${pic[0].title}">
                                                        </div>
                                                        <div class="p-title">
                                                            <a href="./商品详情.html?phone=${num}&id=${element.id}">
                                                                ${element.title};
                                                            </a>
                                                        </div>
                                                        <div class="p-price">
                                                            <h3><span class="yuan">￥</span>${element.price}</h3>
                                                            <a href="./商品详情.html?phone=${num}&id=${element.id}">立刻购买</a>
                                                        </div>
                                                    </a>
                                                </li>
                                            `;
                                        });
                                        // console.log(temp);
                                        $('#list3').append(temp);
                                    }
                                });
                            });
                        </script>
                    </div>
                </div>
        </div>
        <!-- 列表4 -->
        <div style="width: 100%;background: #f2f2f2;">
            <div class="container" id="main">
                <div class="col-xs-12" style="position: relative;padding: 0;">
                    <div class="item-title" id="title4">
                        <h3>
                            <span>
                                <a href="">美妆个护</a>
                            </span>
                        </h3>
                    </div>
                    <div class="list col-xs-12" id="list4">
                    </div>
                    <script>
                        $(function() {
                            let num = location.search.split('=')[1];
                            console.log(num);
                            $.ajax({
                                url: "../lib/getall4.php",
                                type: "get",
                                dataType: "json",
                                success: function(data){
                                    // console.log(data);
                                    let temp="";
                                    data.forEach(element => {
                                        console.log(element.pic);
                                        // console.log(JSON.parse(element.pic));
                                        let pic=JSON.parse(element.pic);
                                        console.log(pic);
                                        temp+=`
                                            <li value="${element.id}">
                                                <a href="./商品详情.html?phone=${num}&id=${element.id}">
                                                    <div class="p-pic">
                                                        <img src="${pic[0].src}" alt=".${pic[0].title}">
                                                    </div>
                                                    <div class="p-title">
                                                        <a href="./商品详情.html?phone=${num}&id=${element.id}">
                                                            ${element.title};
                                                        </a>
                                                    </div>
                                                    <div class="p-price">
                                                        <h3><span class="yuan">￥</span>${element.price}</h3>
                                                        <a href="./商品详情.html?phone=${num}&id=${element.id}">立刻购买</a>
                                                    </div>
                                                </a>
                                            </li>
                                        `;
                                    });
                                    console.log(temp);
                                    $('#list4').append(temp);
                                }
                            });
                        });
                    </script>
                </div>
            </div>
        </div>
        <!-- 底部 -->
        <footer id="footer" style="background: #444;">
            <div class="container">
                <div id="map">
                    <ul class="col-xs-12">
                        <li class="col-xs-2">
                            <a href="">
                                <i><img src="../img/map1.png" alt=""></i>
                                <h4>帮助中心</h4>
                            </a>
                            <p>积分规则 邀请规则</p>
                        </li>
                        <li class="col-xs-2">
                            <a href="">
                                <i><img src="../img/map2.png" alt=""></i>
                                <h4>购物指南</h4>
                            </a>
                            <p>免费注册 快速下单</p>
                        </li>
                        <li class="col-xs-2">
                            <a href="">
                                <i><img src="../img/map3.png" alt=""></i>
                                <h4>售后服务</h4>
                            </a>
                            <p>售后政策 取消订单</p>
                        </li>
                        <li class="col-xs-2">
                            <a href="">
                                <i><img src="../img/map4.png" alt=""></i>
                                <h4>正品保障</h4>
                            </a>
                            <p>正品行货 放心选购</p>
                        </li>
                    </ul>
                </div>
                <div id="info">
                    <a href="">关于我们</a><em>|</em>
                    <a href="">购物指南</a><em>|</em>
                    <a href="">售后服务</a>
                </div>
                <div id="copyright">
                    <p>©  M宝商城  凯盛嘉业网络科技有限公司   粤ICP备17071557号-1   增值电信业务经营许可证：粤B2-20170758  食品经营许可证：JY14401060269164(1-1)</p>
                </div>
                
            </div>
        </footer>
     

    




    <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
    <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
    <!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
  </body>
</html>